#ifndef IO_H_
#define IO_H_

/**************************************Prototypes********************************/

/*-------------------------------------------------------------------------------
 * void putchar (char c)
 * -----------------------------------------------------------------------------*/
 /**Purpose :This function implements a polling method to trasmit data on the terminal.
  * The polling continues until the TI(Transmit Interrupt) Flag in the SCON Register 
  * is set. Thereafter, it copies the contents of it's input parameter into the 
  * Serial Buffer (SBUF)
  * Parameters: c, 8-bit character value
  * Return: void
  *-----------------------------------------------------------------------------*/ 
  void putchar (char c);
 
 /*-----------------------------------------------------------------------------
  * void putstr (char *s)
  * --------------------------------------------------------------------------*/
  /**Purpose: The function uses the putchar() method in an iterative manner to
   * transmit a complete string of characters.At the end of the character string 
   * transmission, a Null character (ASCII 13) is appended to the terminal 
   * output
   * Parameters: s, Pointer of type char, references to the starting address of
   * the string of characters.
   * Return: void
   * *************************************************************************/
   void putstr (char *s);
  /*-----------------------------------------------------------------------------
  *  char getchar ()
  * --------------------------------------------------------------------------*/
  /**Purpose: This function implements a polling method to receive data from
   * the terminal. The polling continues until the RI(Receive Interrupt) Flag 
   * in the SCON Register is set.Thereafter, it retunr the contents of the SBUF
   * Parameters: None
   * Return: char
   * *************************************************************************/
   char getchar ();
  /*-----------------------------------------------------------------------------
  *  void printCustom(char * val)
  * --------------------------------------------------------------------------*/
  /**Purpose: This function implements basic version of the pre-defined printf,
   * The putchar() method is used to send all characters pointed by a character
   * pointer, untill a NULL character is encountered.
   * Parameters: char pointer
   * Return: void
   * *************************************************************************/
   void printCustom(char * val);
   
  /*-----------------------------------------------------------------------------
  * void scanF(char* val,int size)
  * --------------------------------------------------------------------------*/
  /**Purpose: The function implements a user input sequence. The user input is 
   * restricted to value of input parameter 'size'. Received characters are
   * stored at address locations pointed by char pointer val. The input 
   * sequence terminates under two conditions; either the size parameter
   * has reached or a Null character is received.
   * Parameters: char pointer, 8-bit integer
   * Return: void
   * *************************************************************************/
   void scanF(char* val,int size);
   
  /*-----------------------------------------------------------------------------
  * void clrScr()
  * --------------------------------------------------------------------------*/
  /**Purpose: The function prints the terminal clear screen character sequence
   * "\033[2J". Can be effectively used to clear up cluttered terminal screen
   * Parameters: none
   * Return: void
   * *************************************************************************/
   void clrScr();
   
  /*-----------------------------------------------------------------------------
  * void newLine()
  * --------------------------------------------------------------------------*/
  /**Purpose: The function prints a line in dashed characters
   * Return: void
   * *************************************************************************/
   void newLine();
   
  /*-----------------------------------------------------------------------------
  * void readCount()
  * --------------------------------------------------------------------------*/
  /**Purpose: The function reads value from the TH0 and TL0 registers
   * of counter 0. The count is calculated for a 16-bit timer, that is
   * TH0 is multiplied by 256 and added to TL0.
   * Parameters: none
   * Return: void
   * *************************************************************************/
   void readCount();
   
    
#endif /*IO_H_*/
